package com.example.viewpagerindicator;

import java.util.ArrayList;
import java.util.List;

import android.R.fraction;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Menu;

import com.viewpagerindicator.CirclePageIndicator;
import com.viewpagerindicator.apdapter.MyPagerAdapter;
import com.viewpagerindicator.fragment.FragmentA;
import com.viewpagerindicator.fragment.FragmentB;
import com.viewpagerindicator.fragment.FragmentC;

public class MainActivity extends FragmentActivity {
	
	ViewPager mPager;
	CirclePageIndicator mIndicator;
	MyPagerAdapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mPager= (ViewPager) findViewById(R.id.pager);
        mIndicator= (CirclePageIndicator) findViewById(R.id.indicator);
        
        List<Fragment> fragments= new ArrayList<Fragment>();
        FragmentA fragmentA= new FragmentA();
        FragmentB fragmentB= new FragmentB();
        FragmentC fragmentC= new FragmentC();
       
        fragments.add(fragmentA);
        fragments.add(fragmentB);
        fragments.add(fragmentC);
        
        mAdapter= new MyPagerAdapter(getSupportFragmentManager(), fragments);
        mPager.setAdapter(mAdapter);
        mIndicator.setViewPager(mPager);
       
        
 
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
